#include <stdio.h>
#include <stdlib.h>
int main()
{
	int money_give[13] = {0};
	int money_cost[13] = {0};
	int money_left[13] = {0};
	int money_begin[13] = {0};
	int money_mom[13] = {0};
	int ch = 0;
	int month = 0;
	int sum = 0;
	int flag = 0;
	for(int i = 1;i<13;i++)
	{
		money_give[i] = 300;
		scanf("%d",&money_cost[i]);
		money_left[1] = money_give[1] - money_cost[1];
		money_begin[1] = money_give[1];
	}
	for(int i = 1;i<13;i++)
	{
		ch = money_begin[i] - money_cost[i];
		if(ch>0)
		{
			if(ch>=100)
			{
				money_mom[i] = (ch/100)*100;
				money_left[i] = ch%100;
			}
			else
			{
					money_left[i] = ch;
			}
			money_begin[i] = money_left[i-1]+money_give[i];
			
		}
		else
			{
				flag = 1;
				month = -i;
			}
			sum+=money_mom[i];
	}
	if(flag ==1)
	{
		printf("%d",month);
	}
	else
	printf("%d",(int)sum*(1.2));
	
	
	return 0;
}
